package top.lixunda.ecommerce.server.user.api.entity.dto;

import lombok.Data;
import lombok.EqualsAndHashCode;
import top.lixunda.ecommerce.server.user.api.entity.db.BindingTypeDO;
import top.lixunda.common.validate.annotation.*;

/**
 * @author Xumda
 * @version time:2019/12/13 16:15
 * <p>
 * 页面中通过验证验证码进行注册
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class RegisterCodeDTO {

    /**
     * 邮箱登陆 4
     */
    public static final int TYPE_EMAIL = BindingTypeDO.BINDING_TYPE_EMAIL;

    /**
     * 手机号码登陆 5
     */
    public static final int TYPE_PHONE = BindingTypeDO.BINDING_TYPE_PHONE;

    /**
     * 注册账号类型，见常量
     */
    @XumNotNull
    @XumIncludes(numbers = {TYPE_EMAIL, TYPE_PHONE})
    private Integer type;

    /**
     * 注册账号，可以是邮箱，手机
     */
    @XumNotNull
    @XumBetween(min = 6, max = 32)
    private String username;

    /**
     * 初始化昵称，可以为空
     */
    @XumDefault("")
    private String nickname;

    /**
     * 设置密码
     */
    @XumNotNull
    @XumBetween(min = 6, max = 32)
    private String password;

    /**
     * 图片验证码
     */
    @XumNotNull
    @XumRegex("^[0-9a-zA-Z]{4,6}$")
    private String code;

}
